﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RPGProject.GameWorld.GameObjects
{
    /// <summary>
    /// A blank space on the world class.
    /// </summary>
    class NullGameObject : GameObject
    {
        /// <summary>
        /// Default constructor for x, and y.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public NullGameObject(int x, int y)
            : base(x, y, '.', ConsoleColor.Black, "nothing", "null")
        {
        }
        /// <summary>
        /// Listens to a GameObjectEvent, from GameObject.
        /// </summary>
        /// <param name="e">The event to listen to.</param>
        /// <returns>An event if needed.</returns>
        public override GameObjectEvent Listen(GameObjectEvent e)
        {
            GameObjectEvent ret;
            if (e.Has("target") && e["target"] == this)
            {
                // lets the moveAttempt go through
                if (e.Name == "moveAttempt")
                {
                    ret = new GameObjectEvent("move");
                    ret["target"] = e["target"];
                    ret["source"] = e["source"];
                    return ret;
                }

            }
            return null;
        }
        /// <summary>
        /// Overriden AddUpdate to make sure and AddUpdate on a NullGameObject does nothing.
        /// </summary>
        public new void AddUpdate()
        {
        }
        public override string ToString()
        {
            return base.ToString() + " at (" + this["x"] + ", " + this["y"] + ")";
        }
    }
}
